package com;

import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.geometry.Rectangle2D;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.image.Image;
import javafx.stage.Screen;
import javafx.stage.Stage;
import javafx.stage.StageStyle;

public class Main extends Application {

    @Override
    public void start(Stage parentStage) throws Exception{

        /*设置主容器不在标题栏显示*/
        parentStage.initStyle(StageStyle.UTILITY);
        /*设置主容器全透明*/
        parentStage.setOpacity(0);

        Stage mainStage = new Stage();
        // 将 parentStage 设置为归属对象，即父级窗口
        mainStage.initOwner(parentStage);
        /*设置程序透明*/
        mainStage.initStyle(StageStyle.TRANSPARENT);
        /*获取父级容器*/
        Parent gridPane = FXMLLoader.load(getClass().getResource("GridPane.fxml"));
        /*设置容器大小并且载入Scene*/
        Rectangle2D screenRectangle = Screen.getPrimary().getBounds();

        Scene parentScene = new Scene(gridPane, screenRectangle.getWidth()/3, screenRectangle.getHeight());
        /*设置容器透明*/
        parentScene.setFill(null);

        mainStage.setScene(parentScene);

        mainStage.setX(screenRectangle.getWidth() - parentScene.getWidth()- 10);
        mainStage.setY(10);
        parentStage.show();
        mainStage.show();
    }


    public static void main(String[] args) {
        launch(args);
    }
}
